function(qjsc_gen_file)
    set(singlevalues TEMPLATE OUTPUT GENERATOR)
    set(multivalues REQUIRE)
    cmake_parse_arguments(
            ARG
            ""
            "${singlevalues}"
            "${multivalues}"
            ${ARGN}
    )
    set(GENERATOR "$<TARGET_FILE:${ARG_GENERATOR}>")
    set(DEPENDS_LIST ${GENERATOR} ${ARG_TEMPLATE} ${ARG_DEPENDS})

    add_custom_command(OUTPUT ${ARG_OUTPUT}
            COMMENT "Generate file for ${ARG_TEMPLATE}"
            COMMAND ${GENERATOR} -c -o ${ARG_OUTPUT} -m ${ARG_TEMPLATE}
            DEPENDS ${DEPENDS_LIST} ${ARG_REQUIRES}
            )
endfunction()

